#define _USE_MATH_DEFINES
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>

using namespace std;
double const eps = 0.000001;

class TTri {
public:
	static const int INVALID = 0;
	static const int MORE = 1;
	static const int OK = 2;
	
	double edge[3], ang[3];
private:
	const double INV_TRIFUN;
	double sinV[3], cosV[3];

public:
	TTri() : INV_TRIFUN(-10) {
		for (int i=0; i<3; ++i) {
			edge[i] = ang[i] = -1;
			sinV[i] = cosV[i] = INV_TRIFUN;
		}
	}
private:

	bool eq(double x, double y) {
// 		cout << x << " " << y << endl;
		return fabs(x-y)<eps;
	}

	void fillTriFun() {
		for (int i=0; i<3; ++i) {
			if (ang[i] > 0) {
				sinV[i] = sin(ang[i]);
				cosV[i] = cos(ang[i]);
				continue;
			}
			sinV[i] = max(sinV[i], INV_TRIFUN);
			cosV[i] = max(cosV[i], INV_TRIFUN);
		}
	}

	bool fillEdge(int x) {
		//try formula 2
		if (sinV[x] > INV_TRIFUN) {
			for (int i=0; i<3; ++i)
				if (edge[i] > 0 && sinV[i] > INV_TRIFUN) {
					edge[x] = sinV[x] * edge[i] / sinV[i];
					return true;
				}
		}
		//try formula 3
		bool avaliable = true;
		for (int i=0; i<3; ++i){
			if (i == x) continue;
			else {
				if (cosV[i] > INV_TRIFUN && edge[i] > 0) continue;
				else {
					avaliable = false;
					break;
				}
			}
		}
		if (avaliable) {
			edge[x] = edge[(x+1)%3]*cosV[(x+2)%3] + edge[(x+2)%3]*cosV[(x+1)%3];
			return true;
		}
		//try formula 4
		if (cosV[x] > INV_TRIFUN) {
			if (edge[(x+1)%3]>0 && edge[(x+2)%3]>0) {
				edge[x] = sqrt(edge[(x+1)%3]*edge[(x+1)%3]
						+ edge[(x+2)%3]*edge[(x+2)%3]
						- 2*edge[(x+1)%3]*edge[(x+2)%3]*cosV[x]);
				return true;
			}
		}
		return false;
	}

	bool fillAng(int x) {
		//try formula 1
		if (ang[(x+1)%3]>0 && ang[(x+2)%3]>0) {
			ang[x] = M_PI - ang[(x+1)%3] - ang[(x+2)%3];
			return true;
		}
		//try formula 2
		if (edge[x] > 0) {
			for (int i=0; i<3; ++i)
				if (i==x) continue;
				else {
					if (edge[i]>0 && sinV[i]>INV_TRIFUN) {
						sinV[x] = sinV[i] * edge[x] / edge[i];
						return true;
					}
				}
		}
		//try formula 4
		bool avaliable = true;
		for (int i=0; i<3; ++i)
			if (edge[i] <= 0) {
				avaliable = false;
				break;
			}
		if (avaliable) {
			cosV[x] = (edge[(x+1)%3]*edge[(x+1)%3] + edge[(x+2)%3]*edge[(x+2)%3]
					- edge[x]*edge[x]) / (2*edge[(x+1)%3]*edge[(x+2)%3]);
			return true;
		}
		return false;
	}

	bool allFilled(void) {
		for (int i=0; i<3; ++i)
			if (edge[i] <= 0 || ang[i] <= 0)
				return false;
		return true;
	}

	void copy(TTri* x) {
		for (int i=0; i<3; ++i) {
			ang[i] = x->ang[i];
			edge[i] = x->edge[i];
			sinV[i] = x->sinV[i];
			cosV[i] = x->cosV[i];
		}
	}

	int tryBySin(int x) {
		TTri backup;
		backup.copy(this);

		ang[x] = asin(sinV[x]);
		int state = fill();
		if (state == MORE) return MORE;
		copy(&backup);
		ang[x] = M_PI - asin(sinV[x]);
		int state2 = fill();
		copy(&backup);
		if (state==OK && (state2==OK||state2==MORE)) return MORE;
		if (state==INVALID && state2==INVALID) return INVALID;
		return OK;
	}

	bool validate(void) {
		for (int i=0; i<3; ++i) {
			if (edge[i] <= 0) return false;
			if (ang[i] <= 0) return false;
		}
		//try formula 1
		if (!eq(ang[0]+ang[1]+ang[2], M_PI)) return false;
		//try formula 2
		for (int i=0; i<3; ++i)
			if (!eq(edge[i]/sinV[i], edge[(i+1)%3]/sinV[(i+1)%3])) return false;
		//try formula 3
		for (int i=0; i<3; ++i) {
			if (!eq(edge[i], edge[(i+1)%3]*cosV[(i+2)%3]+edge[(i+2)%3]*cosV[(i+1)%3]))
				return false;
		}
		//try formula 4
		for (int i=0; i<3; ++i) {
// 			double b = (edge[(i+1)%3]*edge[(i+1)%3] + edge[(i+2)%3]*edge[(i+2)%3]
// 					- 2*edge[(i+1)%3]*edge[(i+2)%3]*cosV[i]);
// 			double a = edge[i]*edge[i];
// 			cout << a << " " << b << " " << eq(a,b) << endl;

			if (!eq(edge[i]*edge[i], 
					(edge[(i+1)%3]*edge[(i+1)%3] + edge[(i+2)%3]*edge[(i+2)%3]
					- 2*edge[(i+1)%3]*edge[(i+2)%3]*cosV[i])))
				return false;
		}
		//try formula 5
		for (int i=0; i<3; ++i) {
			if (!eq((edge[i]-edge[(i+1)%3])/(edge[i]+edge[(i+1)%3]), 
				tan((ang[i]-ang[(i+1)%3])/2)/tan((ang[i]+ang[(i+1)%3])/2)))
			return false;
		}
		return true;
	}

public:
	int fill(void) {
		fillTriFun();
		int updated = 1;
		while (updated > 0) {
			updated = 0;
			for (int i=0; i<3; ++i) {
				if (edge[i] < 0 && fillEdge(i)) {
					if (edge[i] <= 0) {
						return INVALID;
					}
					updated = 1;
				}
				if (ang[i] < 0 && fillAng(i)) {
					if (cosV[i] > INV_TRIFUN) {
						sinV[i] = sqrt(1 - cosV[i]*cosV[i]);
						ang[i] = asin(sinV[i]);
						if (cosV[i] < 0)
							ang[i] = M_PI - ang[i];
						if (ang[i] <= 0)
							return INVALID;
					}
					if (sinV[i] > INV_TRIFUN && sinV[i] <= 0)
						return INVALID;
					updated = 2;
				}
			}
			if (updated == 2)
				fillTriFun();
		}

		if (!allFilled()) {
			for (int i=0; i<3; ++i) {
				if (ang[i] <= 0 && sinV[i] > INV_TRIFUN) {
					return tryBySin(i);
				}
			}
		}
		else {
			if (validate()) return OK;
		}

		return INVALID;
	}
};

int n;

int main(void)
{
//	freopen("input.txt", "r", stdin);
	TTri tri;
	cin >> n;
	for (int i=0; i<n; ++i) {
		for (int i=0; i<3; ++i) {
			cin >> tri.edge[i] >> tri.ang[i];
		}

		switch (tri.fill()) {
			case 0:
				cout << "Invalid input." << endl;
				break;
			case 1:
				cout << "More than one solution." << endl;
				break;
			case 2:
				for (int i=0; i<3; ++i)
					cout << setprecision(6) << setiosflags(ios::fixed)
							<< tri.edge[i] << " " <<tri.ang[i] << " ";
				cout << endl;
				break;
		}
	}
	return 0;
}
